<!DOCTYPE html>
<html>
<head>
<title>自动化测试报告</title>

<meta charset="utf-8">
<meta name="author" content="ls_seraph@126.com" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- 1.jq引用 -->
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<!-- 2.bootstrap组件引用 -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<!-- 3.百度示图组件引用 -->
<script src="https://cdn.bootcdn.net/ajax/libs/echarts/5.0.1/echarts.min.js"></script>
<!-- 4.矢量图标素材引用 -->
<link href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" rel="stylesheet">
<!-- 5.bootstrap-table组件引用-->
<link href="https://cdn.bootcdn.net/ajax/libs/bootstrap-table/1.18.2/bootstrap-table.min.css" rel="stylesheet">
<script src="https://cdn.bootcdn.net/ajax/libs/bootstrap-table/1.18.2/bootstrap-table.min.js"></script>

<!-- 自己添加的美化属性 -->
<style type="text/css" media="screen">
	/* 按钮美化样式 */
	.form-check-inline {
	  margin: 0 5px 10px 0;
	}
	
	[type="checkbox"] {
	  display: none;
	}
	
	.form-check-label {
	  transition: all 144ms ease-in-out;
	}
	.form-check-label:hover {
	  -webkit-transform: scale(0.975);
	          transform: scale(0.975);
	}
	.form-check-label::before {
	  display: inline-block;
	  margin-right: 2px;
	  transition: -webkit-transform 144ms ease-in-out;
	  transition: transform 144ms ease-in-out;
	  transition: transform 144ms ease-in-out, -webkit-transform 144ms ease-in-out;
	  content: '+';
	}
	
	[type="checkbox"]:not(:checked) + .form-check-label,
	[type="checkbox"]:not(:checked) + .form-check-label:hover {
	  background-color: transparent;
	  color: #363636;
	  border-color: currentColor;
	}
	
	[type="checkbox"]:checked + .form-check-label::before {
	  -webkit-transform: rotate(45deg);
	          transform: rotate(45deg);
	}
	
	@media (min-width: 768px){
		.modal-dialog {
			width: 80%;
			margin: 30px auto;
		}
	}

	/* 报告自适应 */
	dt {
		font-size: 1.5rem;
		text-align: left;
		margin-right: 10px;
		min-width: 80px;
		height: 40px;
		line-height: 40px;
	}
	.dl-horizontal dt {
		width: 100px;
	}

	dd {
		font-size: 1.5rem;
		height: 40px;
		line-height: 40px;
	}
	@media (min-width: 768px){
		.dl-horizontal dd {
			margin-left: 110px;
		}
	}
	/* 块背景色 */
	.jumbotron {
		background-color: rgba(138, 138, 138, 0.1);
	}
	/* 失败用例集 */
	#failCase {
		color: orange;
	}
	/* 错误用例集 */
	#errorCase {
		color: red;
	}
	/* 按钮块样式 */
	.table-bt {
		margin-bottom: 0.625rem;
	}
	/* 内嵌表格样式 去掉自带宽*/
	.detail-view>td{
		padding: 0px 0px 0px 30px !important;
	}
	
	.btn-success{
		color: black;
		background-color: rgba(26, 255, 133, 0.5);
	}
	.btn-warning{
		color: black;
		background-color: rgba(254, 255, 152, 0.6);
	}
	.btn-danger{
		color: black;
		background-color: rgba(255, 0, 0, 0.5);
	}
	
	#toTop{
		position:fixed;
		right:50px; 
		bottom:30px; 
		width:10px; 
		height:10px;
		cursor:pointer; 
		display: none
	}
</style>
</head>
<body>
<div class="container">
	<div class="modal fade" id="alert_img" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-body">
					<img src='' style="width: 100%;"/>
				</div>
			</div>
		</div>
	</div>
	<div class="row clearfix">
		<!-- 报告 -->
		<div class="col-md-6 column simple-report">
			<div class="jumbotron ">
				<h2 id="title"></h2>
				<p id="description"></p>
				<dl class="dl-horizontal">
					<dt>测试人员:</dt>
					<dd><input id="tester" class="form-control" type="text" value="" readonly /></dd>
					<dt>开始时间:</dt>
					<dd><input id="st" class="form-control" type="text" value="" readonly /></dd>
					<dt>结束时间:</dt>
					<dd><input id="et" class="form-control" type="text" value="" readonly /></dd>
					<dt>合计耗时:</dt>
					<dd><input id="ct" class="form-control" type="text" value="" readonly /></dd>
					<dt>测试结果:</dt>
					<dd><input id="rs" class="form-control" type="text" value="" readonly /></dd>
					<!-- 如果想同时打开两个集合 只需要删除 data-parent属性 -->
					<div class="panel-group" id="fail-error">
						<div class="panel panel-default">
							<div class="panel-heading" style="background-color: rgba(254, 255, 152, 0.6);" data-toggle="collapse" data-parent="#fail-error" href="#failCase">
								 失败用例合集(0) 
							</div>
							<div id="failCase" class="panel-collapse collapse">
								<textarea style="width: 100%;height: 120px;resize: none;" readonly> </textarea>
							</div>
						</div>
						<div class="panel panel-default">
							<div class="panel-heading" style="background-color: rgba(255, 0, 0, 0.5);" data-toggle="collapse" data-parent="#fail-error" href="#errorCase" >
								错误用例合集(0)
							</div>
							<div id="errorCase" class="panel-collapse collapse">
								<textarea style="width: 100%;height: 120px;resize: none;" readonly> </textarea>
							</div>
						</div>
					</div>
				</dl>
			</div>
		</div>
		<!-- 示图 -->
		<div class="col-md-6 column">
			<div class="jumbotron">
				<div id="container" style="width: 100%;min-height:40rem;"></div>
			</div>
		</div>
	</div>
	<div class="row clearfix">
		<!-- 按钮 -->
		<div class="col-md-12 column table-bt">
			<input type="checkbox" id="succ" name="check" value="s" checked="checked">
			<label class="form-check-label btn btn-success" for="succ">通过</label>
	
			<input type="checkbox" id="fail" name="check" value="f" checked="checked">
			<label class="form-check-label btn btn-warning" for="fail">失败</label>
	
		
			<input type="checkbox" id="erro" name="check" value="e" checked="checked">
			<label class="form-check-label btn btn-danger" for="erro">错误</label>
		</div>
		<!-- 表格 -->
		<div class="col-md-12 column">
			<table id="suitetable" class="table table-hover"></table>
		</div>
	</div>
</div>
<div style="height: 3.75rem;"></div>
<div id="toTop" onclick="toTop()">
	<a><span class="glyphicon glyphicon-eject" style="font-size:30px;" aria-hidden="true"> </span></a>
</div>
<script language="javascript" type="text/javascript">
infoData = {}
tableData = []
// 调试模板数据
infoDataDef = 
{
	//错误集合
	"fcase": ["test_login_fail_3 (b_login_test.LoginTest)", "test_login_fail_7 (b_login_test.LoginTest)"],
	//失败集合
	"ecase": ["test_login_success_1 (b_login_test.LoginTest)", "test_login_success_2 (b_login_test.LoginTest)"],
	"sc": 5,  //成功数
	"fc": 2,  // 失败数
	"ec": 2,  //错误数
	"cc": 9,  // 总数
	"st": "2021-03-14 08:21:57",  // 开始时间
	"et": "2021-03-14 08:22:49",  // 结束时间
	"ct": 51.84,  // 耗时
	"title": "执行测试报告",
	"description": "测试说明",
	"tester": "执行人"
}
tableDataDef = [{"id": 1,"name": "BaiduTest","comment": "登陆测试","count": 9,"success": 6,"fail": 3,"error": 0,"time": "47.62秒","case": [{"name": "test_input_aaaaa_1","comment": "百度地址测试1","result": 0,"details": "errorImg[104.png]errorImg, browser[chrome(87.0.4280.141)]browser\nSuccess","drive": "chrome(87.0.4280.141)","screenshot": ["image/104.png"]}, {"name": "test_input_aaaaa_2","comment": "百度地址测试2","result": 0,"details": "errorImg[105.png]errorImg, browser[chrome(87.0.4280.141)]browser\nSuccess","drive": "chrome(87.0.4280.141)","screenshot": ["image/105.png"]}, {"name": "test_input_aaaaa_3","comment": "百度地址测试3","result": 1,"details": "errorImg[106.png]errorImg, browser[chrome(87.0.4280.141)]browser\nerrorImg[107.png]errorImg, browser[chrome(87.0.4280.141)]browser\nTraceback (most recent call last):\n  File \"C:\\Users\\Fantasy\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages\\ddt.py\", line 182, in wrapper\n    return func(self, *args, **kwargs)\n  File \"E:\\Python_workspace\\auto_test\\test_case\\case\\ui\\a_baidu_test.py\", line 39, in test_input_aaaaa\n    self.assertEqual(\"True\", excel_data['isTrue'])\nAssertionError: 'True' != 'Flase'\n- True\n+ Flase\n\n","drive": "chrome(87.0.4280.141)","screenshot": ["image/106.png", "image/107.png"]}, {"name": "test_input_aaaaa_4","comment": "百度地址测试4","result": 0,"details": "errorImg[108.png]errorImg, browser[chrome(87.0.4280.141)]browser\nSuccess","drive": "chrome(87.0.4280.141)","screenshot": ["image/108.png"]}, {"name": "test_input_aaaaa_5","comment": "百度地址测试5","result": 0,"details": "errorImg[109.png]errorImg, browser[chrome(87.0.4280.141)]browser\nSuccess","drive": "chrome(87.0.4280.141)","screenshot": ["image/109.png"]}, {"name": "test_input_aaaaa_6","comment": "百度地址测试6","result": 1,"details": "errorImg[110.png]errorImg, browser[chrome(87.0.4280.141)]browser\nerrorImg[111.png]errorImg, browser[chrome(87.0.4280.141)]browser\nTraceback (most recent call last):\n  File \"C:\\Users\\Fantasy\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages\\ddt.py\", line 182, in wrapper\n    return func(self, *args, **kwargs)\n  File \"E:\\Python_workspace\\auto_test\\test_case\\case\\ui\\a_baidu_test.py\", line 39, in test_input_aaaaa\n    self.assertEqual(\"True\", excel_data['isTrue'])\nAssertionError: 'True' != 'Flase'\n- True\n+ Flase\n\n","drive": "chrome(87.0.4280.141)","screenshot": ["image/110.png", "image/111.png"]}, {"name": "test_input_aaaaa_7","comment": "百度地址测试7","result": 0,"details": "errorImg[112.png]errorImg, browser[chrome(87.0.4280.141)]browser\nSuccess","drive": "chrome(87.0.4280.141)","screenshot": ["image/112.png"]}, {"name": "test_input_aaaaa_8","comment": "百度地址测试8","result": 0,"details": "errorImg[113.png]errorImg, browser[chrome(87.0.4280.141)]browser\nSuccess","drive": "chrome(87.0.4280.141)","screenshot": ["image/113.png"]}, {"name": "test_input_aaaaa_9","comment": "百度地址测试9","result": 1,"details": "errorImg[114.png]errorImg, browser[chrome(87.0.4280.141)]browser\nerrorImg[115.png]errorImg, browser[chrome(87.0.4280.141)]browser\nTraceback (most recent call last):\n  File \"C:\\Users\\Fantasy\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages\\ddt.py\", line 182, in wrapper\n    return func(self, *args, **kwargs)\n  File \"E:\\Python_workspace\\auto_test\\test_case\\case\\ui\\a_baidu_test.py\", line 39, in test_input_aaaaa\n    self.assertEqual(\"True\", excel_data['isTrue'])\nAssertionError: 'True' != 'Flase'\n- True\n+ Flase\n\n","drive": "chrome(87.0.4280.141)","screenshot": ["image/114.png", "image/115.png"]}]}, {"id": 2,"name": "LoginTest","comment": "登陆测试","count": 9,"success": 5,"fail": 2,"error": 2,"time": "43.75秒","case": [{"name": "test_login_fail_1","comment": "验证登陆失败","result": 0,"details": "Success","drive": "","screenshot": ""}, {"name": "test_login_fail_2","comment": "验证登陆失败","result": 0,"details": "Success","drive": "","screenshot": ""}, {"name": "test_login_fail_3","comment": "验证登陆失败","result": 1,"details": "errorImg[116.png]errorImg, browser[chrome(87.0.4280.141)]browser\nTraceback (most recent call last):\n  File \"C:\\Users\\Fantasy\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages\\ddt.py\", line 182, in wrapper\n    return func(self, *args, **kwargs)\n  File \"E:\\Python_workspace\\auto_test\\test_case\\case\\ui\\b_login_test.py\", line 45, in test_login_fail\n    self.assertEqual(excel_data['assert'], excel_data['test_value'])\nAssertionError: '用户不存在/密码错误' != 'dfasdasd'\n- 用户不存在/密码错误\n+ dfasdasd\n\n","drive": "chrome(87.0.4280.141)","screenshot": ["image/116.png"]}, {"name": "test_login_fail_4","comment": "验证登陆失败","result": 0,"details": "Success","drive": "","screenshot": ""}, {"name": "test_login_fail_5","comment": "验证登陆失败","result": 0,"details": "Success","drive": "","screenshot": ""}, {"name": "test_login_fail_6","comment": "验证登陆失败","result": 0,"details": "Success","drive": "","screenshot": ""}, {"name": "test_login_fail_7","comment": "验证登陆失败","result": 1,"details": "errorImg[117.png]errorImg, browser[chrome(87.0.4280.141)]browser\nTraceback (most recent call last):\n  File \"C:\\Users\\Fantasy\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages\\ddt.py\", line 182, in wrapper\n    return func(self, *args, **kwargs)\n  File \"E:\\Python_workspace\\auto_test\\test_case\\case\\ui\\b_login_test.py\", line 45, in test_login_fail\n    self.assertEqual(excel_data['assert'], excel_data['test_value'])\nAssertionError: '用户不存在/密码错误' != 'asdasd'\n- 用户不存在/密码错误\n+ asdasd\n\n","drive": "chrome(87.0.4280.141)","screenshot": ["image/117.png"]}, {"name": "test_login_success_1","comment": "对应测试报告中的说明文件验证登陆成功","result": 2,"details": "E:\\Python_workspace\\auto_test\\common\\base\\..\\image/UItest_2021_03_15_09_43_50.png\nerrorImg[118.png]errorImg, browser[chrome(87.0.4280.141)]browser\nTraceback (most recent call last):\n  File \"C:\\Users\\Fantasy\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages\\ddt.py\", line 182, in wrapper\n    return func(self, *args, **kwargs)\n  File \"E:\\Python_workspace\\auto_test\\test_case\\case\\ui\\b_login_test.py\", line 31, in test_login_success\n    login_action.clear_input()\n  File \"E:\\Python_workspace\\auto_test\\actions\\login_action.py\", line 17, in clear_input\n    self.login_page.clear_username()\n  File \"E:\\Python_workspace\\auto_test\\element\\info\\login\\login_pages.py\", line 45, in clear_username\n    self.input_clean(self.username_input)\n  File \"E:\\Python_workspace\\auto_test\\common\\base\\page.py\", line 70, in input_clean\n    element = self.find_element(element_info)\n  File \"E:\\Python_workspace\\auto_test\\common\\base\\page.py\", line 47, in find_element\n    if element is UnboundLocalError:\nUnboundLocalError: local variable 'element' referenced before assignment\n","drive": "chrome(87.0.4280.141)","screenshot": ["image/118.png"]}, {"name": "test_login_success_2","comment": "对应测试报告中的说明文件验证登陆成功","result": 2,"details": "E:\\Python_workspace\\auto_test\\common\\base\\..\\image/UItest_2021_03_15_09_44_10.png\nerrorImg[119.png]errorImg, browser[chrome(87.0.4280.141)]browser\nTraceback (most recent call last):\n  File \"C:\\Users\\Fantasy\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages\\ddt.py\", line 182, in wrapper\n    return func(self, *args, **kwargs)\n  File \"E:\\Python_workspace\\auto_test\\test_case\\case\\ui\\b_login_test.py\", line 31, in test_login_success\n    login_action.clear_input()\n  File \"E:\\Python_workspace\\auto_test\\actions\\login_action.py\", line 17, in clear_input\n    self.login_page.clear_username()\n  File \"E:\\Python_workspace\\auto_test\\element\\info\\login\\login_pages.py\", line 45, in clear_username\n    self.input_clean(self.username_input)\n  File \"E:\\Python_workspace\\auto_test\\common\\base\\page.py\", line 70, in input_clean\n    element = self.find_element(element_info)\n  File \"E:\\Python_workspace\\auto_test\\common\\base\\page.py\", line 47, in find_element\n    if element is UnboundLocalError:\nUnboundLocalError: local variable 'element' referenced before assignment\n","drive": "chrome(87.0.4280.141)","screenshot": ["image/119.png"]}]}]
// 测试集表格配置
suiteTableOption = {
	sidePagination: "true",
	striped: true, // 是否显示行间隔色
	uniqueId: "id",
	idField:"id",
	// search : "true",
	// showColumns: true,  // 显示列选择
	showHeader: true, // 表头是否显示
	pagination: false, // 是否分页
	sortable: false, // 是否启用排序
	detailView:true, // 开启详情模式
	detailViewIcon:true,// 图标列
	detailViewByClick:true,// 点击开启
	// 注册加载子表的事件 $detail：当前行下面创建的新行里面的td对象。
	onExpandRow: function (index, row, $detail) {
		var case_table = $detail.html('<table></table>').find('table');
		caseTableOption["data"] = row["case"]
		$(case_table).bootstrapTable(caseTableOption);
		$detail.find(".bs-bars").remove()
		filterByResult(case_table)
	},
	detailFilter: "suiteClickFilter", // 是否有详情判断
	// 符号配置
	icons:{ detailOpen: 'fa-angle-double-right ', detailClose: 'fa-chevron-down'}, 
	// 表格字段配置
	columns: [
		{
			field: 'id',
			title: 'ID',
			width: 10
		},{
			field: 'name',
			width: 100,
			title: '用例集',
			halign : "center"
		},{
			field: 'comment',
			title: '说明',
			align: "left",
			halign : "center",
			cellStyle: function (value, row, index) {
				return {css: {"min-width": "100px","white-space": "nowrap","text-overflow": "ellipsis","overflow": "hidden","max-width": "150px"}}
			}
		},{
			field: 'count',
			title: '总计',
			align: "center",
			width: 50
		},{
			field: 'success',
			title: '通过',
			align: "center",
			width: 50
		},{
			field: 'fail',
			title: '失败',
			align: "center",
			width: 50
		},{
			field: 'error',
			title: '错误',
			align: "center",
			width: 50
		},{
			field: 'time',
			title: '耗时',
			align: "right",
			halign : "center",
			width: 80
		}]
}
// 测试用例表格配置
caseTableOption={
	toolbar: "#toolbar",
	sidePagination: "true",
	striped: true, // 是否显示行间隔色
	//search : "true",
	pagination: false, // 是否分页
	sortable: false, // 是否启用排序
	
	detailView:true, // 开启详情视树形图模式
	detailViewIcon:false,// 图标列
	detailViewByClick:true,// 详情示图点击
	detailFormatter: function(index, row, $detail){
		var res = row["result"]
		if(res == 1){
			$detail.css("background-color","rgba(254, 255, 152, 0.6)")
		}else if(res == 2){
			$detail.css("background-color","rgba(255, 0, 0, 0.5)")
		}
		return "<div>"+row["details"].replaceAll(", in",",</div>\n<div>in")+"</div>"
	},
	detailFilter: "detailsClickFilter", // 是否有详情判断
	// 表格字段配置
	columns: [{
			field: 'result',
			title: '',
			align : "center",
			width: 50,
			formatter: function(value,item,index){
				// 0通过 1失败 2错误
				if(value == 0){
					return '<i class="fa fa-check-circle" style="font-size: 2rem; color: #007c1d;"></i>'
				}else if(value == 1){
					return '<i class="fa fa-minus-circle" style="font-size: 2rem; color: #bdbd06;"></i>'
				}else if(value == 2){
					return '<i class="fa fa-times-circle" style="font-size: 2rem; color: #b40000;"></i>'
				}else{
					return "异常"
				}
			}
		},{
			field: 'name',
			width: 50,
			title: '测试用例',
			halign : "center"
		},{
			field: 'comment',
			title: '说明',
			halign : "center",
			cellStyle: function (value, row, index) {
				return {
					css: {
						"min-width": "100px",
						"white-space": "nowrap",
						"text-overflow": "ellipsis",
						"overflow": "hidden",
						"max-width": "150px"
					}
				}
			}
			
		},{
			field: 'drive',
			title: '驱动',
			width: 50,
			formatter: function(value,item,index){
				var str =  "<p style='margin: 0;'>" + value.replace('(' ,"\n<p style='margin: 0;'>($1")+""
				return str
			}
		},{
			field: 'screenshot',
			title: '截图',
			width: 50,
			formatter: function(value,item,index){
				var a = ""
				$.each(value, function(index, item) {
				    a += '<a href="#alert_img" role="button" class="btn" data-toggle="modal" onclick="img_click(\''+item+'\')">'+item+'</a>'
				});
				return a
			}
		}]
}
$(function() {
	// 方便查看和修改模板
	var hData = {}
	var tData = []
	if(JSON.stringify(infoData) === '{}'){
		hData = infoDataDef
	}else{
		hData = infoData
	}
	if(tableData.length == 0){
		tData = tableDataDef
	}else{
		tData = tableData
	}
	// 数据加载
	loadInfo(hData);
	loadChart(hData)
	// 距离顶部超过400，增加返回按钮
	$(window).scroll(function(){$("#toTop").css("display", ($(window).scrollTop() >= 400) ?"block":"none")})
	// 测试集表格配置
	suiteTableOption["data"] = tData
	$('#suitetable').bootstrapTable(suiteTableOption);
	// 显示按钮变更触发事件
	$('.table-bt input').change(function(){
		showTpye(tData)
	})
});
// 加载信息
function loadInfo(data){
	$('#title').html(data["title"])
	$('#description').html(data["description"])
	$('#tester').val(data["tester"])
	$('#st').val(data["st"])
	$('#et').val(data["et"])
	$('#ct').val(data["ct"]+" 秒")
	var rsStr = ""
	if(data["sc"]>0){
		rsStr = rsStr + "成功：" + data["sc"] + " 个；"
	}
	if(data["fc"]>0){
		rsStr = rsStr + "失败：" + data["fc"] + " 个；"
	}
	if(data["ec"]>0){
		rsStr = rsStr + "错误：" + data["ec"] + " 个；"
	}
	$('#rs').val("共："+data["cc"] +" 个；"+rsStr)
	$('#fail-error .panel-heading').eq(0).html("失败用例合集("+data["fc"]+")")
	$('#fail-error .panel-heading').eq(1).html("错误用例合集("+data["ec"]+")")
	$('#failCase textarea').val(data['fcase'])
	$('#errorCase textarea').val(data['ecase'])
}
// 加载示图
function loadChart(data){
	// 增加环状图
	var echartsOption = {
		tooltip: {trigger: 'item',formatter: "{b}:{c}个({d}%)"},
		legend: {top: '5%',left: 'right',orient: 'vertical',type: 'scroll'},
		series: [{name: '结果比例',type: 'pie',radius: ['45%', '70%'],avoidLabelOverlap: false,label: {show: true,position: "outside",formatter: "{b}\n{c}\n{d}%"},labelLine: {show: true,length: 20,lineStyle: {width: 1,type: 'solid'}},emphasis: {label: {show: true,fontSize: '15'}},itemStyle: {borderRadius: 10,borderColor: '#fff',borderWidth: 5},
			data: [{
				value: data['sc'],
				name: '成功',itemStyle: {normal: {color: 'rgba(26, 255, 133, 0.5)'}}
			}, {
				value: data['fc'],
				name: '失败',itemStyle: {normal: {color: 'rgba(254, 255, 152, 0.6)'}}
			}, {
				value: data['ec'],
				name: '错误',itemStyle: {normal: {color: 'rgba(255, 0, 0, 0.5)'}}
			}]
		}]
	};
	var chart = echarts.init(document.getElementById('container'));
	chart.setOption(echartsOption);
	//根据窗口的大小变动图表位置
	window.onresize = function() {chart.resize();}
}
// 回到顶部
function toTop(){
	$("html,body").animate({
		"scrollTop": 0
	}, 700)
}
// 用例集表格 可点击过滤方法 只有失败和错误的可以点击
function suiteClickFilter(index, row) {
	return row['fail']>0 || row['error']>0
}
// 用例表格
function detailsClickFilter(index, row, item) {
	return row["result"] != 0
}
// 图片点击事件
function img_click(src){
	$("#alert_img img").attr('src',"").attr('src',src)
}
// 详情展开 index是序列
function expand (index){ 
	$("#suitetable").bootstrapTable('expandRow', index); 
}

// 显示按钮
function showTpye(data){
	var num = ''
	$("input[name='check']:checkbox").each(function() { 
		if($(this).is(":checked")){
			num += this.value
		}
	});
	$.each(data,function(index,item){
		var su = item["success"]
		var fa = item["fail"]
		var er = item["error"]
		$('#suitetable').bootstrapTable('hideRow', {index:index})
		if(num.indexOf("s")!=-1){
			if(su >= 0 && fa == 0 && er == 0){
				$('#suitetable').bootstrapTable('showRow', {index:index})
			}
		}
		if(num.indexOf("f")!=-1){
			if(fa>0){
				$('#suitetable').bootstrapTable('showRow', {index:index})
			}
		}
		if(num.indexOf("e")!=-1){
			if(er>0){
				$('#suitetable').bootstrapTable('showRow', {index:index})
			}
		}
	})
}
// 显示那种类型数据
function showTpye(data){
	var num = ''
	$("input[name='check']:checkbox").each(function() { 
		if($(this).is(":checked")){
			num += this.value
		}
	});
	$.each(data,function(index,item){
		var su = item["success"]
		var fa = item["fail"]
		var er = item["error"]
		$('#suitetable').bootstrapTable('hideRow', {index:index})
		if(num.indexOf("s")!=-1){
			if(su >= 0 && fa == 0 && er == 0){
				$('#suitetable').bootstrapTable('showRow', {index:index})
			}
		}
		if(num.indexOf("f")!=-1){
			if(fa>0){
				$('#suitetable').bootstrapTable('showRow', {index:index})
			}
		}
		if(num.indexOf("e")!=-1){
			if(er>0){
				$('#suitetable').bootstrapTable('showRow', {index:index})
			}
		}
	})
}
// 根据结果过滤内容
function filterByResult(table){
	var check_result = []
	$("input[name='check']:checkbox").each(function() { 
		if($(this).is(":checked")){
			if(this.value == "s"){
				check_result.push(0)
			}
			if(this.value == "f"){
				check_result.push(1)
			}
			if(this.value == "e"){
				check_result.push(2)
			}
		}
	});
	table.bootstrapTable('filterBy', {result: check_result})
}
	
</script>
</body>
</html>
